package javaGuide;

interface SmsServiceStatic {
    String send(String message);
}

class SmsServiceStaticImpl implements SmsServiceStatic { //被代理类
    public String send(String message) {
        System.out.println("send message:" + message);
        return message;
    }
}
class SmsProxyStatic implements SmsServiceStatic { //代理类

    private final SmsServiceStatic smsService;
    public SmsProxyStatic(SmsServiceStatic smsService) {
        this.smsService = smsService;
    }
    @Override
    public String send(String message) {
        //调用方法之前，我们可以添加自己的操作
        System.out.println("before method send()");
        smsService.send(message);
        //调用方法之后，我们同样可以添加自己的操作
        System.out.println("after method send()");
        return null;
    }
}
public class StaticProxy {
    public static void main(String[] args) {
        SmsServiceStatic smsService = new SmsServiceStaticImpl();
        SmsProxyStatic smsProxy = new SmsProxyStatic(smsService);
        smsProxy.send("java");
    }
}
